class Skill:
    def __init__(self, name, camp=None, introduction=None, is_learn=False):
        self.name = name
        self.camp = camp
        self.experience = 0
        self.rank = 1
        self.introduction = introduction
        self.is_learn = is_learn

    # 使用技能
    def use(self):
        self.experience += 1
        current_rank, next_rank_need_experience = self.get_rank()
        print('----------------------------------------------------')
        print("\033[0;33;40m " + '使用技能：' + self.name + 'lv' + str(self.rank) + ' 经验：' + str(self.experience) + '/' + str(
            next_rank_need_experience) + "\033[0m")

    # 计算经验是否能升级
    def get_rank(self):
        count = 5
        if self.camp == '人族':
            count *= 1.0
        elif self.camp == '兽族':
            count *= 1.1
        elif self.camp == '暗夜精灵':
            count *= 0.5
        while self.experience > self.rank * count:
            self.experience -= self.rank * count
            self.upgrade()
        return self.rank, self.rank * count

    # 技能升级
    def upgrade(self):
        self.rank += 1
        print('----------------------------------------------------')
        print("\033[0;33;40m 技能升级！ {} \033[0m".format(self.name + 'lv' + str(self.rank)))
